-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Natural Language API #1440
Introduce Natural Language API #1440
Conversation
@callmehiphop let me know what you think of the usability. Ready to start on tests after. |
Could you throw up a gist or something of more code examples? Or is the README example all there is to it? |
README + system tests is all for now. It's not a very big API, just 3 methods. I did fail to mention there's a The two primary ways of calling are // inline
language.detectEntities('a sentence', function(err, entities) {});
// with a document
var document = language.detectEntities('a sentence');
document.detectEntities(function(err, entities) {}); The verbose mode just makes less simplifications. These tests show what the general responses look like in simple/verbose mode for each annotation type (annotation, entities, sentiment): https://github.com/stephenplusplus/gcloud-node/blob/spp--language/system-test/language.js#L314 LMKIYHAQ |
I see, is there a reason we only provide convenience methods for entities and sentiment? Where as your readme example shows tokens, language and sentences as well. |
There are only 3 API endpoints, see https://cloud.google.com/natural-language/reference/rest/v1beta1/documents:
|
We can add things like |
We took this exact approach with the vision api, did we not? Granted the vision
Can't this be prevented with documentation? Stating that it's a convenience method for |
No, the Vision API has one API method that returns a response that matches the type of request you send. So we have
What we're talking about here is making a request that includes a lot of info, but only returning a part of it. I can see both sides here, however this is new territory for us. I feel conflicted because we would essentially be throwing away information. Docs can help, but a user simply seeing methods called |
Ah, my mistake. Fair enough then, feel free to ignore! |
@@ -701,6 +702,71 @@ vision.detectFaces('./image.jpg', function(err, faces) { | |||
``` | |||
|
|||
|
|||
## Google Cloud Natural Language (Alpha) | |||
|
|||
> **This is an Alpha release of Google Cloud Resource Manager.** This feature is not covered by any SLA or deprecation policy and may be subject to backward-incompatible changes. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
33bfcdb
to
2c8a839
Compare
All tested and doc'd @callmehiphop. PTAL when you can. |
86fbe99
to
8cd0ac3
Compare
@jmuk -- I rebased this PR against @jmdobry's modularization PR. That is still in development, but it will hopefully merge soon. You can use the new structure to get started with #1464. If the changes you make can be limited to just creating files, as opposed to amending the files in You will need to run these commands when setting up the repo: $ ./scripts/link.sh
$ cd packages/language
$ npm install
# good to go-- helpful development commands:
$ npm run lint
$ npm run test
$ npm run system-test @callmehiphop sorry for the huge PR now... all of the language changes for review are here: https://github.com/stephenplusplus/gcloud-node/tree/spp--language/packages/language |
2a64114
to
a59a816
Compare
@jmuk @callmehiphop -- I rebased this off of master now. |
41fd353
to
84d255c
Compare
// Authorizing on a per-API-basis. You don't need to do this if you auth on a | ||
// global basis (see Authorization section above). | ||
|
||
var languageClient = language({ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@callmehiphop anything left for me to do here? |
Document.formatTokens_ = util.noop; | ||
}); | ||
|
||
it('should return the language and syntax by default', function(done) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@stephenplusplus I had a couple small comments, but nothing really important. I think overall it looks good, my only real complaint is that the system tests were a little tricky to work through. |
ecfbeda
to
a3bfc96
Compare
Yeah, the system tests have a unique style for sure. If it gets to be impossible to deal with when adding new features/debugging, we can look into changing that. PTAL! |
}); | ||
}); | ||
|
||
it('should return the syntax by default', function(done) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -287,7 +287,7 @@ describe('Document', function() { | |||
Document.formatTokens_ = util.noop; | |||
}); | |||
|
|||
it('should return the language by default', function(done) { | |||
it('should return language if no features are requested', function(done) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* language: implement API
Upstream API docs:
Docs preview:
To Dos